package com.streamer.app.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.streamer.app.fragment.ProductListFragment

class ProductPagerAdapter(private val fragmentActivity: FragmentActivity, private val roomId: String) : FragmentStateAdapter(fragmentActivity) {
    
    override fun getItemCount(): Int = 2
    
    override fun createFragment(position: Int): Fragment {
        return when (position) {
            0 -> ProductListFragment.newInstance(fragmentActivity,true, roomId)  // 售卖中
            1 -> ProductListFragment.newInstance(fragmentActivity, false,roomId) // 已下架
            else -> ProductListFragment.newInstance(fragmentActivity, true,roomId)
        }
    }
} 